cmake_minimum_required(VERSION 3.10)
project(TrackNetV3_TRT)

set(CMAKE_CXX_STANDARD 14)

# 查找必要的包
find_package(OpenCV REQUIRED)

# 设置TensorRT路径（根据实际安装路径修改）
set(CUDA_TOOLKIT_ROOT_DIR "/usr/local/cuda")
set(TENSORRT_ROOT "/home/imvision/software/TensorRT-8.6.1.6")

# 包含目录
include_directories(
    ${OpenCV_INCLUDE_DIRS}
    ${CUDA_TOOLKIT_ROOT_DIR}/include
    ${TENSORRT_ROOT}/include
)

# 链接目录
link_directories(
    ${TENSORRT_ROOT}/lib
    ${CUDA_TOOLKIT_ROOT_DIR}/lib64
)

# 添加可执行文件
add_executable(tracknetv3_demo 
    main.cpp 
    tracknetv3_trt.cpp
)

# 链接库
target_link_libraries(tracknetv3_demo
    ${OpenCV_LIBS}
    cudart
    nvinfer
    nvonnxparser
)

# CUDA支持
if(CUDA_FOUND)
    enable_language(CUDA)
    target_link_libraries(tracknetv3_demo ${CUDA_LIBRARIES})
endif()

if(CMAKE_COMPILER_IS_GNUCXX)
    target_compile_options(tracknetv3_demo PRIVATE -Wall -Wextra)
endif()
